/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2022-11-10
 * Time: 14:54
 */
public class Student {
    public String name;
    public int age;
    public  static String classroom="高三一班";
    public static int height;

    public Student() {
        System.out.println("不带参数的构造方法");
    }

   /* public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }*/
   /* public Student(String name, int age,int he) {
        this.name = name;
        this.age = age;
        height=he;
    }*/
    static {
        System.out.println("静态代码块");
    }
    {

        age=12;
        System.out.println("实例代码块");
    }

    public static int getHeight() {
        return height;

    }

    public static void func(){
        {
            System.out.println("定义在方法内部叫做普通代码块");
        }
    }
    public static void setHeight(int height) {
        Student.height = height;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    public static void main(String[] args) {
        /*Student student1=new Student("魏鸿雁",18);
        Student student2=new Student("王一博",18);*/
      /*  System.out.println(student1.classroom);
        System.out.println(student2.classroom);
        student1.setHeight(2);
        System.out.println(getHeight());
        System.out.println(student1);*/
        Student student=new Student();
        Student.func();


    }
}
